home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / ppc.com / TIMER.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-03-31  |  939 b   |  42 lines

  1.  
  2. unit timer ;
  3.  
  4. {
  5.  Title     : TIMER.PAS
  6.  Author    : Robert Upleger
  7.  Date      : March 24, 1991
  8.  Intent    : Timing function performed by the IBM 8253 timer chip
  9. }
  10.  
  11. interface
  12.  
  13.      function Current_Sec : real ;
  14.      { returns the number of seconds since most recent midnight }
  15.  
  16.  
  17. implementation
  18.  
  19. uses DOS ;
  20.  
  21.      function Current_Sec : real ;
  22.      { returns the number of seconds since most recent midnight }
  23.      var
  24.           hour,                { 0 - 24 }
  25.           min,                 { 0 - 60 }
  26.           sec,                 { 0 - 60 }
  27.           frac  : integer   ;  { 0 - 99 }
  28.           regs  : registers ;
  29.      begin
  30.           regs.ah := $2C    ;
  31.           msdos ( regs )    ;
  32.           hour := regs.ch   ;
  33.           min  := regs.cl   ;
  34.           sec  := regs.dh   ;
  35.           frac := regs.dl   ;
  36.           Current_Sec := ( hour * 60 + min ) * 60 + sec + frac/100
  37.      end ;
  38.  
  39. begin
  40. end.
  41.  
  42.